home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / Pack_kat.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-26  |  2KB  |  95 lines

  1. /*************************************************************************
  2.  Pack_kat.rexx  0.2 (1.3.96) by Eric Sauvageau
  3.  
  4.  Script for XPkatana - Will pack the specified file with the (optional) 
  5.    specified packer.  Specifying "?" as the source file will open a file
  6.    requester, asking for the source.
  7.  
  8.  Usage: Pack_kat.rexx <filename> [packer]
  9.  
  10. **************************************************************************/
  11.  
  12.  
  13. /*** We want ANSWERS!!! :) ***/
  14.   Options results
  15.  
  16. /*** 
  17.      We need to get the shell's path, so XPKatana will be able to
  18.      locate the desired source file if XPKatana can't locate it.
  19. ***/
  20.  
  21.   path = Pragma('D','')
  22.   If Right(path,1) ~= ':' Then path = path||'/'
  23.  
  24. /*** I wanna talk to ya :) ***/
  25.   Address 'KATANA'
  26.  
  27.  
  28. /*** Retrieve the arguments from the command line ***/
  29.   Parse Arg source packer
  30.  
  31.   If source = "" Then Do
  32.      Say "You must supply a source file, or use "?" for a file requester."
  33.      Exit 10
  34.   End
  35.  
  36.  
  37. /*** Tell XPKatana what is the source file. ***/
  38.   SETSOURCE source ; found = result
  39.  
  40. /*****
  41.      If XPKatana can't find it, then try again, but adding the
  42.      current process's full path.
  43. *****/
  44.   IF (found = 'NOFILE') & (source ~= '?') Then SETSOURCE path||source
  45.  
  46.  
  47.  
  48. /*** Store the current packer, packmode and NoProgress. ***/
  49.   GETMODEINFO 1 ; oldmode = result
  50.   GETLIBINFO  1 ; oldpacker = result
  51.   GETFLAG NOPROGRESS ; oldprogress = result
  52.  
  53. /***** 
  54.    If there's a specified packer, use it.  If not, the 
  55.    current one will be used instead.
  56. *****/
  57.   If packer ~= "" Then Do
  58.      SETPACKER packer oldmode ; error = result
  59.      If error = "BADPACKER" Then Do
  60.         Say 'Invalid packer!'
  61.         Exit 10
  62.      End
  63.   End
  64.  
  65. /*** Set XPKatana to "No progress window". ***/
  66.   SETFLAGS NOPROGRESS 1
  67.  
  68. /*****
  69.    Pack the file, keeping the same filename (unless 
  70.    "Handle Suffix" was previously enabled 
  71. *****/
  72.   Say "Packing..."
  73.   PACK ; error = result
  74.  
  75.   If error = "ABORT" Then Do
  76.      Say "Packing aborted or failed!" 
  77.    End
  78.  
  79.    Else Do
  80.  
  81. /*** Examine the packed file to retrieve the ratio. ***/
  82.  
  83.     EXAMINE ; e_string = result
  84.     Parse Var e_string e_filename e_packer e_encrypted e_ratio e_description
  85.     Say "Packed with "||e_packer||" (Gain: "||e_ratio||"%)."
  86.   End
  87.  
  88.  
  89.  
  90. /*** Restore the settings, and exit. ***/
  91.   SETPACKER oldpacker oldmode
  92.   SETFLAGS NOPROGRESS oldprogress
  93.  
  94. Exit
  95.